define(function(require, exports, module) {
	require('jquery');
	require('easing');
	require('fancybox');

	function model(){
		this.init();
	};

	model.prototype = {

        init: function(){
            var sf = this;
            var wh = $(window).height();
            $('.user_right_wrap_box,.personal_setting_wrap_box,.social_setting_wrap_box').css({'height':wh-75});
            $('.user_right_wrap_box .tx').hover(
                function() {
                    $('.user_right_wrap_box .tx .h').css({'display':'block'});
                },
                function() {
                    $('.user_right_wrap_box .tx .h').css({'display':'none'});
                }
            );

            $('#p_setting a').on('click', function(){
                $('.btnwrap1').removeClass('bgb');
                $('#p_setting').addClass('bgb');
                $(".u_wrap_box").animate({ 
                    right: -320
                }, 10 );
                $(".personal_setting_wrap_box").animate({ 
                    right: +320
                }, 500 );
            });
            $('#s_setting a').on('click', function(){
                $('.btnwrap1').removeClass('bgb');
                $('#s_setting').addClass('bgb');
                $(".u_wrap_box").animate({ 
                    right: -320
                }, 10 );
                $(".social_setting_wrap_box").animate({ 
                    right: +320
                }, 500 );
            });

            $('.personal_setting_wrap_box .edit').on('click', function(){
                sf.changePassword();
            });

            /*改头像*/
            $('.user_right_wrap_box .tx .h').on('click',function(){
                $.fancybox.open(sf.htmltpl.changetx,{
                    wrapCSS : 'own_skin',
                    padding : 0
                });
            });

        },
        htmltpl:{
            changePassword: $('<div class="item">现有密码<br /><input type="password" class="form_text" name="" id=""></div><div class="item">新设密码<br /><input type="password" class="form_text" name="" id=""></div><div class="item">重复新设密码<br /><input type="password" class="form_text" name="" id=""></div><div class="item cf"><a href="" class="submit left">保存</a><a href="" class="cancel right">取消</a></div>'),
            changetx: $('<div class="changetx"><div class="inner"></div></div>')
        },
        
        changePassword: function () {
            var sf = this;
            var htmlwrap = $('.personal_setting_wrap_box .items .cf').html('');
            var html = sf.htmltpl.changePassword;
            html.appendTo(htmlwrap);
        },

        
        
	};
	module.exports = new model();
});

